package com.lian.community.service.token;

import com.lian.community.constant.EntityType;
import com.lian.community.constant.RedisKeyType;
import com.lian.community.dao.redis.JedisDAO;
import com.lian.community.util.RedisKeyUtil;
import com.lian.community.util.SaltUtil;
import jdk.nashorn.internal.parser.Token;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TokenService {

    @Autowired
    JedisDAO jedisDAO;

    public void addToken(String userMes, String token){
        jedisDAO.setex(token, 60*60*24*14, userMes);
    }

    public String getVal(String token){
        return jedisDAO.get(token);
    }

    public boolean containsToken(String token){
        return jedisDAO.get(token) != null;
    }


    public void deleteToken(String token){
        jedisDAO.del(token);
    }

}
